package NewOOP;

public class Student {
    public String name;
    public String gender;
    public int age;
    public double score;
    public static String classRoom ;


    public void study(){
        System.out.println(name + "正在学习呢" );
    }
    public void info(){
        System.out.println(name + " " + age);
    }

    public Student(String name, String gender, int age, double score) {
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.score = score;
    }
    public static void fun1(String n1){
        classRoom = n1;
        System.out.println(classRoom);
    }

    public static void main(String[] args) {
        System.out.println(Student.classRoom);//静态成员变量可以直接通过类名访问

        Student s1 = new Student("Lileo","男",18,3.8);
        Student s2 = new Student("hanmeimei","女",19,4.0);
        Student s3 = new Student("jim","男",18,2.6);

        //静态成员变量也可以直接通过类名访问
        System.out.println(s1.classRoom);
        System.out.println(s2.classRoom);
        System.out.println(s3.classRoom);

        //也可以公开的静态方法进行访问
        fun1("911");

    }

    }

